package com.syqc.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.syqc.custom.ChooseLineView
import com.syqc.entity.KeyValue
import com.syqc.monitor.R

/**
 *@Author Jasper
 *@Time   2020/9/28
 *@Desc   todo
 */
class KeyValueAdapter : BaseQuickAdapter<KeyValue, BaseViewHolder>(R.layout.item_key_value) {
    var index = -1
    override fun convert(holder: BaseViewHolder, item: KeyValue) {
        item.run {
            val view: ChooseLineView = holder.getView<ChooseLineView>(R.id.cl_key_value)
            view.setStartSelect(holder.layoutPosition == index)
            view.setTitle(value)
        }
    }
}